//package com.example.zuoye.config;
//
//import com.example.zuoye.interceptor.UserLoginInterceptor;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.*;
//
//@Configuration
//public class LoginConfig implements WebMvcConfigurer {
//
//    @Value("${uploadPathImg}")
//    private String uploadPathImg;
//
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/static/**")
//                .addResourceLocations("classpath:/static/");
//
//        registry.addResourceHandler("/upload_img/**")
//                .addResourceLocations("file:"+uploadPathImg);//定义图片存放路径
//    }
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        //注册TestInterceptor拦截器
//        InterceptorRegistration registration = registry.addInterceptor(new UserLoginInterceptor());
//        registration.addPathPatterns("/**"); //所有路径都被拦截
//        registration.excludePathPatterns(    //添加不拦截路径
//                "/user/**",                  //user下的子目录不拦截
//                "/index/**",                 //index下的子目录不拦截
//                "/item/**",
//                "/shop/**",
//                "/search/**",
//                "/**/*.html",
//                "/**/*.css",
//                "/**/*.js",
//                "/**/*.jpg",
//                "/**/*.png",
//                "/**/*.gif"
//        );
//    }
//}
//
